diff --git a/.github/actions/check-generation/action.yml b/.github/actions/check-generation/action.yml new file mode 100644 index 00000000000..a3332f99a9c --- /dev/null +++ b/.github/actions/check-generation/action.yml @@ -0,0 +1,11 @@ +name: "Check generation is committed" +description: "Ensure that all code generation is present in the commits" +runs: + using: composite + steps: + - shell: bash + run: | + git add . + git update-index --refresh + git diff-index --quiet --exit-code HEAD tensorflow-core/tensorflow-core-api/src/gen/** || \ + (git --no-pager diff HEAD -- ; echo "::error file=changes.txt,line=0,title=\"Un-commited generation\"::Generated classes after build do not match what was committed" ; exit 1) \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9e001606a23..1859ad49be3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,7 +26,7 @@ jobs: run: | yum -y update yum -y install centos-release-scl-rh epel-release - yum -y install java-11-openjdk-devel devtoolset-7 + yum -y install java-11-openjdk-devel devtoolset-7 git echo Downloading Maven curl -L https://archive.apache.org/dist/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz -o $HOME/apache-maven-3.6.3-bin.tar.gz tar xzf $HOME/apache-maven-3.6.3-bin.tar.gz -C /opt/ @@ -41,6 +41,8 @@ jobs: - name: Run lint checks run: | mvn compiler:compile -Pdev,jdk11 -B -U -e + - name: Check for un-committed generation + uses: ./.github/actions/check-generation check-format: if: github.event_name == 'pull_request' runs-on: ubuntu-latest @@ -148,6 +150,8 @@ jobs: echo Executing Maven $MAVEN_PHASE mvn clean $MAVEN_PHASE -B -U -e -Djavacpp.platform=linux-x86_64 -Djavacpp.platform.extension=${{ matrix.ext }} -pl $NATIVE_BUILD_PROJECTS -am -DstagingRepositoryId=${{ needs.prepare.outputs.stagingRepositoryId }} "-Dnative.build.flags=$BAZEL_CACHE" df -h + - name: Check for un-committed generation + uses: ./.github/actions/check-generation macosx-x86_64: if: github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'CI build') runs-on: macos-latest @@ -184,6 +188,8 @@ jobs: echo Executing Maven $MAVEN_PHASE mvn clean $MAVEN_PHASE -B -U -e -Djavacpp.platform=macosx-x86_64 -Djavacpp.platform.extension=${{ matrix.ext }} -pl $NATIVE_BUILD_PROJECTS -am -DstagingRepositoryId=${{ needs.prepare.outputs.stagingRepositoryId }} "-Dnative.build.flags=$BAZEL_CACHE" df -h + - name: Check for un-committed generation + uses: ./.github/actions/check-generation windows-x86_64: if: github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'CI build') runs-on: windows-latest @@ -261,6 +267,8 @@ jobs: if ERRORLEVEL 1 exit /b df -h wmic pagefile list /format:list + - name: Check for un-committed generation + uses: ./.github/actions/check-generation deploy: if: github.event_name == 'push' && contains(github.ref, 'master') needs: [linux-x86_64, macosx-x86_64, windows-x86_64] diff --git a/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/Ops.java b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/Ops.java index b4ab7753142..4728f0a0c89 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/Ops.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/Ops.java @@ -341,70 +341,70 @@ * } */ public final class Ops { - public final NnOps nn; - - public final SummaryOps summary; - - public final ImageOps image; + public final AudioOps audio; - public final RaggedOps ragged; + public final BitwiseOps bitwise; public final DataOps data; - public final ShapeOps shape; + public final DtypesOps dtypes; + + public final ImageOps image; public final IoOps io; - public final DtypesOps dtypes; + public final LinalgOps linalg; - public final XlaOps xla; + public final MathOps math; - public final LinalgOps linalg; + public final NnOps nn; - public final RandomOps random; + public final QuantizationOps quantization; - public final StringsOps strings; + public final RaggedOps ragged; - public final SparseOps sparse; + public final RandomOps random; - public final BitwiseOps bitwise; + public final ShapeOps shape; - public final TpuOps tpu; + public final SignalOps signal; - public final MathOps math; + public final SparseOps sparse; - public final AudioOps audio; + public final StringsOps strings; - public final SignalOps signal; + public final SummaryOps summary; + + public final TpuOps tpu; public final TrainOps train; - public final QuantizationOps quantization; + public final XlaOps xla; private final Scope scope; private Ops(Scope scope) { this.scope = scope; - nn = new NnOps(this); - summary = new SummaryOps(this); - image = new ImageOps(this); - ragged = new RaggedOps(this); + audio = new AudioOps(this); + bitwise = new BitwiseOps(this); data = new DataOps(this); - shape = new ShapeOps(this); - io = new IoOps(this); dtypes = new DtypesOps(this); - xla = new XlaOps(this); + image = new ImageOps(this); + io = new IoOps(this); linalg = new LinalgOps(this); + math = new MathOps(this); + nn = new NnOps(this); + quantization = new QuantizationOps(this); + ragged = new RaggedOps(this); random = new RandomOps(this); - strings = new StringsOps(this); + shape = new ShapeOps(this); + signal = new SignalOps(this); sparse = new SparseOps(this); - bitwise = new BitwiseOps(this); + strings = new StringsOps(this); + summary = new SummaryOps(this); tpu = new TpuOps(this); - math = new MathOps(this); - audio = new AudioOps(this); - signal = new SignalOps(this); train = new TrainOps(this); - quantization = new QuantizationOps(this); + xla = new XlaOps(this); } /** diff --git a/tensorflow-core/tensorflow-core-generator/src/main/java/org/tensorflow/processor/operator/OperatorProcessor.java b/tensorflow-core/tensorflow-core-generator/src/main/java/org/tensorflow/processor/operator/OperatorProcessor.java index 70c7bb0a7de..051d0104499 100644 --- a/tensorflow-core/tensorflow-core-generator/src/main/java/org/tensorflow/processor/operator/OperatorProcessor.java +++ b/tensorflow-core/tensorflow-core-generator/src/main/java/org/tensorflow/processor/operator/OperatorProcessor.java @@ -698,19 +698,21 @@ private static void addGroupFields( MethodSpec.Builder ctorBuilder, List groups, boolean isTopClass) { - groups.forEach( - group -> { - classBuilder.addField( - FieldSpec.builder(group.className, group.fieldName) - .addModifiers(Modifier.PUBLIC, Modifier.FINAL) - .build()); - ctorBuilder - .addStatement( - "$L = new $T(" + (isTopClass ? "this" : "ops") + ")", - group.fieldName, - group.className) - .build(); - }); + groups.stream() + .sorted(Comparator.comparing(g -> g.fieldName)) + .forEach( + group -> { + classBuilder.addField( + FieldSpec.builder(group.className, group.fieldName) + .addModifiers(Modifier.PUBLIC, Modifier.FINAL) + .build()); + ctorBuilder + .addStatement( + "$L = new $T(" + (isTopClass ? "this" : "ops") + ")", + group.fieldName, + group.className) + .build(); + }); } private static AnnotationMirror getAnnotationMirror(Element element, Name annotationName) {