diff --git a/diylc/.github/workflows/test.yml b/diylc/.github/workflows/test.yml new file mode 100644 index 00000000..0b7d7c72 --- /dev/null +++ b/diylc/.github/workflows/test.yml @@ -0,0 +1,28 @@ +name: Test Build + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + with: + path: diy-layout-creator + + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + cache: maven + + - name: Build with Maven + run: | + cd diy-layout-creator/diylc + mvn -B test --file pom.xml \ No newline at end of file diff --git a/diylc/.github/workflows/tests.yml b/diylc/.github/workflows/tests.yml new file mode 100644 index 00000000..f9d01b4d --- /dev/null +++ b/diylc/.github/workflows/tests.yml @@ -0,0 +1,51 @@ +name: Java CI Tests + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Set up JDK + uses: actions/setup-java@v3 + with: + java-version: '11' # Adjust version as needed + distribution: 'temurin' + cache: maven + + - name: Run Tests + run: mvn test + + # Generate and report coverage without failing + - name: Generate Coverage Report + run: mvn jacoco:report + + - name: Report Coverage + run: | + COVERAGE=$(mvn jacoco:report | grep -oP 'Total coverage: \K[0-9.]+' || echo "unknown") + echo "Current test coverage: $COVERAGE%" + + - name: Upload Coverage Report + uses: actions/upload-artifact@v3 + with: + name: coverage-report + path: target/site/jacoco/ + + # Optional: Comment test results on PR + - name: Add Test Results Comment + uses: marocchino/sticky-pull-request-comment@v2 + if: github.event_name == 'pull_request' + with: + message: | + ### Test Results Summary + ✅ Tests completed + 📊 Coverage: ${{ env.COVERAGE }}% + + Coverage report available in workflow artifacts \ No newline at end of file diff --git a/diylc/diylc-core/src/main/java/org/diylc/core/gerber/GerberExporter.java b/diylc/diylc-core/src/main/java/org/diylc/core/gerber/GerberExporter.java index 916d904a..e041e9e2 100644 --- a/diylc/diylc-core/src/main/java/org/diylc/core/gerber/GerberExporter.java +++ b/diylc/diylc-core/src/main/java/org/diylc/core/gerber/GerberExporter.java @@ -13,6 +13,9 @@ import java.util.Map; import java.util.Set; import java.util.stream.Collectors; import org.apache.log4j.Logger; + +import com.bancika.gerberwriter.DataLayer; + import org.diylc.core.ComponentState; import org.diylc.core.IBoard; import org.diylc.core.IDIYComponent; @@ -21,7 +24,6 @@ import org.diylc.core.Project; import org.diylc.core.measures.Size; import org.diylc.core.measures.SizeUnit; import org.diylc.lang.LangUtil; -import com.bancika.gerberwriter.DataLayer; public class GerberExporter { diff --git a/diylc/diylc-core/src/main/resources/update.xml b/diylc/diylc-core/src/main/resources/update.xml index 4fb0b8e6..d6e57062 100644 --- a/diylc/diylc-core/src/main/resources/update.xml +++ b/diylc/diylc-core/src/main/resources/update.xml @@ -261,6 +261,10 @@ IMPROVEMENT Significantly improved rendering performance + + IMPROVEMENT + Significantly improved rendering performance + IMPROVEMENT Upgraded source code structure to modern standards and introduced Maven diff --git a/diylc/diylc-library/src/main/java/org/diylc/components/boards/AbstractBoard.java b/diylc/diylc-library/src/main/java/org/diylc/components/boards/AbstractBoard.java index 30915872..8a2d1ddb 100644 --- a/diylc/diylc-library/src/main/java/org/diylc/components/boards/AbstractBoard.java +++ b/diylc/diylc-library/src/main/java/org/diylc/components/boards/AbstractBoard.java @@ -28,6 +28,7 @@ import java.awt.Graphics2D; import java.awt.geom.Point2D; import java.awt.geom.Rectangle2D; import org.diylc.appframework.miscutils.ConfigurationManager; + import org.diylc.awt.StringUtils; import org.diylc.common.HorizontalAlignment; import org.diylc.common.IPlugInPort; diff --git a/diylc/diylc-library/src/main/java/org/diylc/components/boards/BlankBoard.java b/diylc/diylc-library/src/main/java/org/diylc/components/boards/BlankBoard.java index eb697516..2cbbe0be 100644 --- a/diylc/diylc-library/src/main/java/org/diylc/components/boards/BlankBoard.java +++ b/diylc/diylc-library/src/main/java/org/diylc/components/boards/BlankBoard.java @@ -28,6 +28,7 @@ import java.awt.Graphics2D; import java.awt.Shape; import java.awt.geom.Point2D; import java.awt.geom.Rectangle2D; + import org.diylc.common.ObjectCache; import org.diylc.components.transform.SimpleComponentTransformer; import org.diylc.core.ComponentState; diff --git a/diylc/diylc-swing/deploy/mac/README.md b/diylc/diylc-swing/deploy/mac/README.md new file mode 100644 index 00000000..1c0f346e --- /dev/null +++ b/diylc/diylc-swing/deploy/mac/README.md @@ -0,0 +1,166 @@ +# Setting up macOS Build Environment for DIYLC + +This document describes how to set up a macOS machine for building and signing DIYLC application bundles. + +## Prerequisites + +1. **macOS System** + - macOS 11 (Big Sur) or later + - Xcode Command Line Tools installed + ```bash + xcode-select --install + ``` + +2. **Java Development Kit** + - Install JDK 17 (recommended to use SDKMAN!) + ```bash + # Install SDKMAN! + curl -s "https://get.sdkman.io" | bash + source "$HOME/.sdkman/bin/sdkman-init.sh" + + # Install JDK 17 + sdk install java 17.0.14-tem + ``` + +3. **Maven** + - Install Maven 3.9 or later + ```bash + sdk install maven + ``` + +## Apple Developer Account Setup + +1. **Apple Developer Account** + - Enroll in the [Apple Developer Program](https://developer.apple.com/programs/) + - You need a paid membership ($99/year) for distribution signing + +2. **Developer Certificate** + - Open Keychain Access + - Go to Certificate Assistant → Request a Certificate from a Certificate Authority + - Fill in your email and name + - Save to disk + - Go to [Apple Developer Certificates](https://developer.apple.com/account/resources/certificates/list) + - Create a new Developer ID Application certificate + - Download and double-click to install in Keychain + +3. **Notarization Setup** + - Create an app-specific password: + 1. Go to [Apple ID Account](https://appleid.apple.com/) + 2. Security → App-Specific Passwords → Generate Password + 3. Save this password securely + + - Create a keychain profile for notarization: + ```bash + xcrun notarytool store-credentials "AC_PASSWORD" \ + --apple-id "your.email@example.com" \ + --team-id "YOUR_TEAM_ID" \ + --password "app-specific-password" + ``` + +## Environment Configuration + +1. **Set Developer Identity** + - Find your Developer ID in Keychain Access + ```bash + security find-identity -v -p codesigning + ``` + - Set the environment variable (add to your ~/.zshrc): + ```bash + export APPLE_DEVELOPER_IDENTITY="Developer ID Application: Your Name (TEAM_ID)" + ``` + +2. **Verify Setup** + ```bash + # Verify codesign is available + codesign --version + + # Verify notarytool is available + xcrun notarytool --version + + # Verify your identity is set + echo $APPLE_DEVELOPER_IDENTITY + ``` + +## Building DIYLC + +1. **Clone the Repository** + ```bash + git clone https://github.com/bancika/diy-layout-creator.git + cd diy-layout-creator/diylc + ``` + +2. **Build for Intel Macs** + ```bash + mvn clean package -P mac-x86 + ``` + +3. **Build for Apple Silicon Macs** + ```bash + mvn clean package -P mac-arm + ``` + +4. **Build Both Architectures** + ```bash + mvn clean package -P mac-x86,mac-arm + ``` + +## Output Files + +After successful builds, you'll find these files in the `diylc-swing/target` directory: + +**Signed and Notarized Builds:** +- `diylc--osx-x86.zip` - Signed and notarized Intel build +- `diylc--osx-arm.zip` - Signed and notarized ARM build + +**Unsigned Builds:** +- `diylc--osx-x86-unsigned.zip` - Unsigned Intel build +- `diylc--osx-arm-unsigned.zip` - Unsigned ARM build + +The unsigned builds are created before the signing and notarization process and can be useful for testing or in environments where code signing is not required. + +## Troubleshooting + +1. **Signing Issues** + - Verify your certificate is valid: + ```bash + security find-identity -v -p codesigning + ``` + - Check certificate expiration in Keychain Access + +2. **Notarization Issues** + - Check notarization status: + ```bash + xcrun notarytool log --keychain-profile "AC_PASSWORD" + ``` + - Verify entitlements are correct in `deploy/mac/entitlements.plist` + +3. **Build Issues** + - Clear Maven cache: + ```bash + rm -rf ~/.m2/repository/org/diylc + ``` + - Verify JDK version: + ```bash + java -version + ``` + +## Common Issues + +1. **"The specified item could not be found in the keychain"** + - Solution: Verify your Developer ID certificate is in the keychain + - Check the exact name matches `APPLE_DEVELOPER_IDENTITY` + +2. **"No account for team found"** + - Solution: Verify your Apple Developer membership is active + - Check team ID in notarytool credentials + +3. **"The binary is not signed"** + - Solution: Check that the signing process isn't being skipped + - Verify all dependencies are properly signed + +## Support + +For additional help: +- Check the [Apple Code Signing Documentation](https://developer.apple.com/documentation/security/notarizing_macos_software_before_distribution) +- File an issue on the DIYLC GitHub repository +- Contact the development team \ No newline at end of file diff --git a/diylc/diylc-swing/deploy/mac/README.txt b/diylc/diylc-swing/deploy/mac/README.txt new file mode 100644 index 00000000..2e48c691 --- /dev/null +++ b/diylc/diylc-swing/deploy/mac/README.txt @@ -0,0 +1,17 @@ +Thank you for downloading DIY Layout Creator! + +This app bundle is fully functional but not officially notarized by Apple. +To run it on your Mac, you'll need to approve it in the 'Privacy & Security' settings. + +Without this approval, macOS will mark it as potentially damaged and prevent it from opening. + +A notarized version is available, but due to Apple Developer Program costs and additional requirements, +it is exclusively offered to DIYLC Patreon supporters. For a small monthly membership fee, +you'll receive several benefits: + +- Access to the notarized version +- Early access to upcoming features +- Voting rights to influence the development roadmap +- Direct developer support + +Join our community at http://www.diy-fever.com/patreon diff --git a/diylc/diylc-swing/deploy/mac/entitlements.plist b/diylc/diylc-swing/deploy/mac/entitlements.plist new file mode 100644 index 00000000..b0612d04 --- /dev/null +++ b/diylc/diylc-swing/deploy/mac/entitlements.plist @@ -0,0 +1,20 @@ + + + + + com.apple.security.cs.allow-jit + + com.apple.security.cs.allow-unsigned-executable-memory + + com.apple.security.cs.disable-library-validation + + com.apple.security.cs.debugger + + com.apple.security.get-task-allow + + com.apple.security.files.user-selected.read-write + + com.apple.security.files.downloads.read-write + + + \ No newline at end of file diff --git a/diylc/diylc-swing/pom.xml b/diylc/diylc-swing/pom.xml index 2846e3e0..95c2456b 100644 --- a/diylc/diylc-swing/pom.xml +++ b/diylc/diylc-swing/pom.xml @@ -180,6 +180,17 @@ false diylc + + + org.diylc.DIYLCStarter + + + + + + *:* + + *:* @@ -190,11 +201,104 @@ - - - org.diylc.DIYLCStarter - - + false + false + true + ${project.build.directory}/dependency-reduced-pom.xml + + + + + + org.apache.maven.plugins + maven-dependency-plugin + 3.6.1 + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + 3.6.1 + + + copy-system-dependencies + prepare-package + + copy-dependencies + + + system + ${project.build.directory}/system-libs + + + + + + + + org.apache.maven.plugins + maven-antrun-plugin + 3.1.0 + + + merge-system-jars + package + + run + + + + + + + + + + + + + + sign-jar-launcher + package + + run + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -238,7 +342,6 @@ linux-appimage ${project.build.directory}/AppDir - ${appdir.dir}/usr/bin/jre 17.0.14+7 17.0.14_7 OpenJDK17U-jre_x64_linux_hotspot_${jdk.version.file}.tar.gz @@ -305,21 +408,22 @@ compression="gzip" /> - - + + - + + + + + JAVA_HOME="$APPDIR/usr/lib/jre" + JAVA_HOME="$APPDIR/usr/bin/jre" + - - - - - @@ -555,7 +659,7 @@ 17.0.14_7 OpenJDK17U-jre_x64_mac_hotspot_${jdk.version.file}.tar.gz https://github.com/adoptium/temurin17-binaries/releases/download/jdk-${jdk.version}/${jdk.archive.osx} - ${project.build.directory}/jre_x86 + ${project.build.directory}/jre_x86.bundle @@ -657,10 +761,158 @@