Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generation Software Bill of Materials (SBOM) #4314

Draft
wants to merge 109 commits into
base: main
Choose a base branch
from

Conversation

gamlerhart
Copy link
Contributor

Motivation: Often larger projects need a
Software Bill of Materials (SBOM) to track dependencies across their projects.
So the project can track things like vulnerable
components, licenses etc.

  • Refactor Courier support to return the original dependency as well.
  • Start of support for CycloneDX format

This is more a QnA pull request.

@gamlerhart gamlerhart changed the title WIP: Generation Software Bill of Materials (SBOM) Questions PR: Generation Software Bill of Materials (SBOM) Jan 13, 2025
Copy link
Contributor Author

@gamlerhart gamlerhart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added my questions as code review annotations.

import java.time.Instant
import java.util.{Base64, UUID}

object CycloneDXModule {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignore the Module: Needs a bit more work =).

@gamlerhart gamlerhart changed the title Questions PR: Generation Software Bill of Materials (SBOM) Generation Software Bill of Materials (SBOM) Jan 20, 2025
@gamlerhart gamlerhart force-pushed the experiment-sbom branch 3 times, most recently from 072d39a to e9307ac Compare January 28, 2025 21:21
imdaveho and others added 21 commits February 9, 2025 21:55
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
…#4356)

## Provided in this PR

After running Instrumental tests the XML will automatically created in
the **out/app/it/testTask.dest/** directory


![image](https://github.com/user-attachments/assets/db5a0afc-511b-4df2-86cb-f8c66292f5ba)

## JUnit XML validation

Using this online tool
[link](https://lotterfriends.github.io/online-junit-parser/#case.0.0) we
can validate that the XML is correct


![image](https://github.com/user-attachments/assets/7f1f5c44-59f2-4143-a5cd-c4d2d3d55831)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
The PR adds non-regression tests for BOM use in `compileIvyDeps` and
`runIvyDeps`, and makes sure BOMs of a module can be used in its test
modules.

---------

Co-authored-by: Li Haoyi <[email protected]>
The mac-latest and mac-13 workers seem significantly slower than the
default linux worker, so just run a single thirdparty example as a
smoketest on each one
…ral (com-lihaoyi#4386)

Fixes com-lihaoyi#4373

This only affects people running clicking links or running commands
manually to download the bootstrap scripts or example projects, or
manually running `./mill init`, so it won't break any automated
releases.

This lets us substantially simplify the github actions workflows and
build config
The Mill Client only forwards requests and therefore does not need much
memory.
However, Java doesn't know that an allocates a large heap based on the
machines memory size.

Therefore, give a way lower heap limit,
creating a leaner client memory wise.

Example on my machine:
- Before: A Mill client reserved ~500MByte
- After: A Mill client reserves the specified 24Mbyte

This is mostly relevant for a long running mill client (examples
`--watch` clients, `-i --no-build-lock` and --bsp`).

Co-authored-by: Li Haoyi <[email protected]>
…m-lihaoyi#4362)

## This PR provides

- ability to import a mill android project to android studio via BSP,
including sources and generated sources.
- necessary changes to the way sources are resolved (through module
dependency instead of class inheritance).
- Changes to tests (e.g. number of sources compiled) reflect these
changes

### Not provided

- Compilation still needs to be done from the command line in order for
the paths to be resolved inside the IDE.

Note that to make compilation, running, testing and debugging work from
android studio, we'll need to develop a plugin for it

## Note

This is an early draft and I need to cleanup or review a few rough
edges, I submit this as a draft to get some early feedback.

I've implemented java to get the basics to work, as kotlin has multiple
kinds of sources and files that need to be taken care of, so this is
just a small step.

Don't hesitate to point out any issues as I've really just braced
through and hacked around to get this to work!

@0xnm @lihaoyi  any feedback will be appreciated!

## Android Studio Integration

The attempt focuses on BSP. Although bsp as a plugin does not seem to be
available for android studio, it strangely becomes available if it is
installed through intelliJ (see video)


### Basic changes

- Use the moduleDeps instead of resolving the classpath bits (sources,
resources) through inheritance. This makes BSP and studio integration
work (see the directories that are highlighted correctly)
- Crude implementation of bsp methods to get the IDE to report the
imported modules correctly

### Tricky parts

- Resources are compiled twice due to how aapt linking and later the
module deps compile hierarchy. In order to avoid this, I've added an
empty generatedSources method in android instrumentation module .

### Demo

You can see in the demo most of the IDE static import features work (R
is not recognised but I'll look into it either in this PR or
subsequent).


https://github.com/user-attachments/assets/77fe5e52-57e7-4480-9971-b50cc8d4d839



EDIT: I've fixed the R not being recognised and the kotlin import


![image](https://github.com/user-attachments/assets/69d810c9-9dd5-40ca-98d3-387d8693cc0e)


EDIT 2: Added summary at the top
Like the title says, this option allows users of the `scalapb`-Plugin to
submit the option `scala3_sources` to `scalapb` directly.

---------

Co-authored-by: Björn Eyselein <[email protected]>
Co-authored-by: Li Haoyi <[email protected]>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
lihaoyi and others added 27 commits February 9, 2025 21:55
The actual analysis is delegated to the well-known coverage.py package.
* Increase `-j` parallelism to 0.75C to try and saturate the CPU
* Move android parallelism limit out of `action.yml`, where the `if`
condition was for some reason not evaluating properly
* Split up some big integration suites to take advantage of
`testForkGrouping`

Fixes com-lihaoyi#4440. Manually looked
at the CI logs to see that the test command is now running without `-j1`
and the status ticker is showing multiple tasks running at once

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
…al (com-lihaoyi#4340)

This needs to wait until Graal support in Mill is released in 0.12.6
The earlier PR defined `ExampleCrossModuleAndroid` but didn't use it

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This is work in progress to fix
com-lihaoyi#3152

Numerous fixes were also needed to com-lihaoyi/mainargs,
com-lihaoyi/sourcecode, and com-lihaoyi/mill-moduledefs

With the current state, only 1 example/integration tests is still
failing:
- `integration.feature[plugin-classpath].local`

known TODOs:
- [x] Discover macro
- [x] Applicative macro
- [x] Caller macro
- [x] Cross.Factory macro
- [x] EnclosingClass macro
- [x] Task macros
- [x] Cacher macro
- [x] Moduledefs compiler plugin (override inferrence)
- [x] All core Mill modules compile with Scala 3.5.0
- [x] Fix Zinc reporter patch linenumbers of build scripts
- [x] Check that bytecode analyzers work with Scala 3
- [x] cleanup library dependency conflicts
- [x] Support new Scala 3 syntax in build.sc files
- [x] ~Fix BSP reporter linenumbers for build scripts~ (Zinc reporter
forwards to bsp)
- [ ] Cleanup compiler warnings for outdated syntax

known incompatibilities:
- [ ] can't use `ExplicitResultTypes` scalafix rule - need to upgrade
mill-scalafix
- [x] ~`Cross.scala` uses the new quoted type syntax which scalafmt
crashes on, (and version is frozen) so skip the file~ upgraded Scalafmt
so not skipped anymore
- [ ] skipping Mima currently due to 1000s of errors (perhaps we should
generate filters?)
- [ ] filtered one flaky test from `example.thirdparty[mockito]`
- [ ] filtered out `integration.feature[plugin-classpath]` due to third
party plugin dep

---------

Co-authored-by: Li Haoyi <[email protected]>
Changelog https://com-lihaoyi.github.io/upickle/#4.0.0

This is a binary incompatible change and will need to go into 0.13.0
…i#4452) (com-lihaoyi#4454)

Resolve com-lihaoyi#4451 

It seems that `transitiveCoursierProjects` is populated with repetitive
transitive modules, that's why it only causes problem for large build.

Please open all PRs as drafts and ensure that your fork of Mill has 
`settings/actions` / `Allow all actions and reusable workflows` enabled
to run CI on
your own fork of the Mill repo. Only once CI passes mark the PR as
`Ready for review`
and CI will run on the main Mill repo before we merge it.

Co-authored-by: Mai Huy Hoàng <[email protected]>
* Make `Discover` return a `class` (that can be evolved by adding
fields) rather than a `Tuple` (which cannot)
* Simplify handling of `millDiscover` flags, in particular we do not
need them to be defined for subfolder base modules
* Remove unused `ObjectDataInstrument`, `Snippet`, `ObjectData`
* Remove `MILL_SPLICED_CODE_START_MARKER`

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Motivation: Often larger projects need a
Software Bill of Materials (SBOM) to track dependencies
across their projects.
So the project can track things like vulnerable
components, licenses etc.

- Refactor Coursier support to return the
original dependency as well.
- Start of support for CycloneDX format
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.