Skip to content

Commit

Permalink
apply license to more generated files, simplify copying
Browse files Browse the repository at this point in the history
  • Loading branch information
SirYwell committed Apr 7, 2024
1 parent ad940ba commit a1b2d3f
Show file tree
Hide file tree
Showing 19 changed files with 52 additions and 17 deletions.
2 changes: 1 addition & 1 deletion LICENSE-short.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
SPDX-License-Identifier: (MIT OR CECILL-C)

Copyright (C) 2006-2024 INRIA and contributors
Copyright (C) 2006-2023 INRIA and contributors

Spoon is available either under the terms of the MIT License (see LICENSE-MIT.txt) or the Cecill-C License (see LICENSE-CECILL-C.txt). You as the user are entitled to choose the terms under which to adopt Spoon.
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@
<consoleOutput>true</consoleOutput>
<!-- we exclude the generated files, see CtGenerationTest -->
<excludes>spoon/support/visitor/clone/CloneBuilder.java</excludes>
<excludes>spoon/support/visitor/clone/CloneVisitor.java</excludes>
<excludes>spoon/reflect/visitor/CtBiScannerDefault.java</excludes>
<excludes>spoon/support/visitor/equals/EqualsVisitor.java</excludes>
<excludes>spoon/support/visitor/replace/ReplacementVisitor.java</excludes>
Expand Down
3 changes: 3 additions & 0 deletions spoon-pom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,9 @@
<include>src/main/java/**</include>
<!-- We also want to check the license in templates to generate files with the proper header -->
<include>src/test/java/spoon/generating/clone/*</include>
<include>src/test/java/spoon/generating/meta/*</include>
<include>src/test/java/spoon/generating/replace/*</include>
<include>src/test/java/spoon/generating/scanner/*</include>
</includes>
</licenseSet>
</licenseSets>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* SPDX-License-Identifier: (MIT OR CECILL-C)
*
* Copyright (C) 2006-2024 INRIA and contributors
* Copyright (C) 2006-2023 INRIA and contributors
*
* Spoon is available either under the terms of the MIT License (see LICENSE-MIT.txt) or the Cecill-C License (see LICENSE-CECILL-C.txt). You as the user are entitled to choose the terms under which to adopt Spoon.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* SPDX-License-Identifier: (MIT OR CECILL-C)
*
* Copyright (C) 2006-2024 INRIA and contributors
* Copyright (C) 2006-2023 INRIA and contributors
*
* Spoon is available either under the terms of the MIT License (see LICENSE-MIT.txt) or the Cecill-C License (see LICENSE-CECILL-C.txt). You as the user are entitled to choose the terms under which to adopt Spoon.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* SPDX-License-Identifier: (MIT OR CECILL-C)
*
* Copyright (C) 2006-2024 INRIA and contributors
* Copyright (C) 2006-2023 INRIA and contributors
*
* Spoon is available either under the terms of the MIT License (see LICENSE-MIT.txt) or the Cecill-C License (see LICENSE-CECILL-C.txt). You as the user are entitled to choose the terms under which to adopt Spoon.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* SPDX-License-Identifier: (MIT OR CECILL-C)
*
* Copyright (C) 2006-2024 INRIA and contributors
* Copyright (C) 2006-2023 INRIA and contributors
*
* Spoon is available either under the terms of the MIT License (see LICENSE-MIT.txt) or the Cecill-C License (see LICENSE-CECILL-C.txt). You as the user are entitled to choose the terms under which to adopt Spoon.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* SPDX-License-Identifier: (MIT OR CECILL-C)
*
* Copyright (C) 2006-2024 INRIA and contributors
* Copyright (C) 2006-2023 INRIA and contributors
*
* Spoon is available either under the terms of the MIT License (see LICENSE-MIT.txt) or the Cecill-C License (see LICENSE-CECILL-C.txt). You as the user are entitled to choose the terms under which to adopt Spoon.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* SPDX-License-Identifier: (MIT OR CECILL-C)
*
* Copyright (C) 2006-2024 INRIA and contributors
* Copyright (C) 2006-2023 INRIA and contributors
*
* Spoon is available either under the terms of the MIT License (see LICENSE-MIT.txt) or the Cecill-C License (see LICENSE-CECILL-C.txt). You as the user are entitled to choose the terms under which to adopt Spoon.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* SPDX-License-Identifier: (MIT OR CECILL-C)
*
* Copyright (C) 2006-2024 INRIA and contributors
* Copyright (C) 2006-2023 INRIA and contributors
*
* Spoon is available either under the terms of the MIT License (see LICENSE-MIT.txt) or the Cecill-C License (see LICENSE-CECILL-C.txt). You as the user are entitled to choose the terms under which to adopt Spoon.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* SPDX-License-Identifier: (MIT OR CECILL-C)
*
* Copyright (C) 2006-2024 INRIA and contributors
* Copyright (C) 2006-2023 INRIA and contributors
*
* Spoon is available either under the terms of the MIT License (see LICENSE-MIT.txt) or the Cecill-C License (see LICENSE-CECILL-C.txt). You as the user are entitled to choose the terms under which to adopt Spoon.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* SPDX-License-Identifier: (MIT OR CECILL-C)
*
* Copyright (C) 2006-2024 INRIA and contributors
* Copyright (C) 2006-2023 INRIA and contributors
*
* Spoon is available either under the terms of the MIT License (see LICENSE-MIT.txt) or the Cecill-C License (see LICENSE-CECILL-C.txt). You as the user are entitled to choose the terms under which to adopt Spoon.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* SPDX-License-Identifier: (MIT OR CECILL-C)
*
* Copyright (C) 2006-2024 INRIA and contributors
* Copyright (C) 2006-2023 INRIA and contributors
*
* Spoon is available either under the terms of the MIT License (see LICENSE-MIT.txt) or the Cecill-C License (see LICENSE-CECILL-C.txt). You as the user are entitled to choose the terms under which to adopt Spoon.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* SPDX-License-Identifier: (MIT OR CECILL-C)
*
* Copyright (C) 2006-2024 INRIA and contributors
* Copyright (C) 2006-2023 INRIA and contributors
*
* Spoon is available either under the terms of the MIT License (see LICENSE-MIT.txt) or the Cecill-C License (see LICENSE-CECILL-C.txt). You as the user are entitled to choose the terms under which to adopt Spoon.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/spoon/generating/replace/ReplaceScanner.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* SPDX-License-Identifier: (MIT OR CECILL-C)
*
* Copyright (C) 2006-2024 INRIA and contributors
* Copyright (C) 2006-2023 INRIA and contributors
*
* Spoon is available either under the terms of the MIT License (see LICENSE-MIT.txt) or the Cecill-C License (see LICENSE-CECILL-C.txt). You as the user are entitled to choose the terms under which to adopt Spoon.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* SPDX-License-Identifier: (MIT OR CECILL-C)
*
* Copyright (C) 2006-2024 INRIA and contributors
* Copyright (C) 2006-2023 INRIA and contributors
*
* Spoon is available either under the terms of the MIT License (see LICENSE-MIT.txt) or the Cecill-C License (see LICENSE-CECILL-C.txt). You as the user are entitled to choose the terms under which to adopt Spoon.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* SPDX-License-Identifier: (MIT OR CECILL-C)
*
* Copyright (C) 2006-2024 INRIA and contributors
* Copyright (C) 2006-2023 INRIA and contributors
*
* Spoon is available either under the terms of the MIT License (see LICENSE-MIT.txt) or the Cecill-C License (see LICENSE-CECILL-C.txt). You as the user are entitled to choose the terms under which to adopt Spoon.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* SPDX-License-Identifier: (MIT OR CECILL-C)
*
* Copyright (C) 2006-2024 INRIA and contributors
* Copyright (C) 2006-2023 INRIA and contributors
*
* Spoon is available either under the terms of the MIT License (see LICENSE-MIT.txt) or the Cecill-C License (see LICENSE-CECILL-C.txt). You as the user are entitled to choose the terms under which to adopt Spoon.
*/
Expand Down
33 changes: 32 additions & 1 deletion src/test/java/spoon/processing/CtGenerationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import spoon.Launcher;
import spoon.compiler.Environment;
Expand All @@ -27,8 +28,10 @@
import spoon.reflect.visitor.PrinterHelper;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
import java.util.function.Supplier;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
Expand Down Expand Up @@ -110,7 +113,6 @@ public void testGenerateCtBiScanner() {
launcher.setOutputFilter(new RegexFilter("spoon.reflect.visitor.CtBiScannerDefault"));
launcher.run();

// cp ./target/generated/spoon/reflect/visitor/CtBiScannerDefault.java ./src/main/java/spoon/reflect/visitor/CtBiScannerDefault.java
// we don't necessarily want to hard-wired the relation between CtScanner and CtBiScannerDefault.java
// this can be done on an informed basis when important changes are made in the metamodel/scanner
// and then we can have smaller clean tested pull requests to see the impact of the change
Expand Down Expand Up @@ -194,6 +196,35 @@ public void testGenerateRoleHandler() {
assertThat(actual).isEqualTo(expected);
}

@Test
@Disabled("only meant to be run manually to make copying easier")
void copyGeneratedFiles() throws IOException {
copy(
"./target/generated/spoon/support/visitor/replace/ReplacementVisitor.java",
"./src/main/java/spoon/support/visitor/replace/ReplacementVisitor.java"
);
copy(
"./target/generated/spoon/reflect/visitor/CtBiScannerDefault.java",
"./src/main/java/spoon/reflect/visitor/CtBiScannerDefault.java"
);
copy(
"./target/generated/spoon/support/visitor/clone/CloneBuilder.java",
"./src/main/java/spoon/support/visitor/clone/CloneBuilder.java"
);
copy(
"./target/generated/spoon/support/visitor/clone/CloneVisitor.java",
"./src/main/java/spoon/support/visitor/clone/CloneVisitor.java"
);
copy(
"./target/generated/spoon/reflect/meta/impl/ModelRoleHandlers.java",
"./src/main/java/spoon/reflect/meta/impl/ModelRoleHandlers.java"
);
}

private static void copy(String from, String to) throws IOException {
Files.copy(Path.of(from), Path.of(to), StandardCopyOption.REPLACE_EXISTING);
}

private void configurePrinter(Launcher launcher) {
Environment environment = launcher.getEnvironment();
environment.setPrettyPrinterCreator(new Supplier<>() {
Expand Down

0 comments on commit a1b2d3f

Please sign in to comment.