# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: netbeans
version: "10.0"
summary: Apache NetBeans IDE (incubating)
description: |
  Apache NetBeans IDE (incubating) lets you quickly and easily develop Java 
  desktop and web applications, as well as HTML5 applications with 
  HTML, JavaScript, and CSS. The IDE also provides a great set of tools for PHP
  developers.
  It is free and open source and has a large community of users and developers
  around the world. 
icon: ../../platform/core.startup/src/org/netbeans/core/startup/frame512.png
confinement: classic
grade: stable
architectures: [ amd64 ]

parts:
  build:
    build-packages:
        - openjdk-8-jdk-headless
        - ant
    build: |
        JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64"
        export JAVA_HOME
        ant -quiet -Djavac.compilerargs=-nowarn -Dbuild.compiler.deprecation=false
    build-attributes: [ no-patchelf ]
    plugin: nil
    source: ../../
    filesets:
        netbeans: [ netbeans/*, -netbeans/*.built ]
    install: |
        mv nbbuild/netbeans $SNAPCRAFT_PART_INSTALL/netbeans
        # Make the default cache and data directory relative to Snap user directory
        sed -i 's/${HOME}\/.netbeans/${SNAP_USER_COMMON}\/data/' $SNAPCRAFT_PART_INSTALL/netbeans/bin/netbeans
        sed -i 's/${HOME}\/.cache\/netbeans/${SNAP_USER_COMMON}\/cache/' $SNAPCRAFT_PART_INSTALL/netbeans/bin/netbeans
        sed -i 's/-J-Dapple.laf.useScreenMenuBar=true/-J-Dplugin.manager.install.global=false -J-Dawt.useSystemAAFontSettings=on/' $SNAPCRAFT_PART_INSTALL/netbeans/etc/netbeans.conf
    stage:
        - $netbeans

apps:
  netbeans:
    command: netbeans/bin/netbeans


